<template>
  <s-table
    bordered
    ref="table"
    :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
    :row-key="(record) => record.id"
    :columns="checkColumns"
    :data="checkData"
  >
    <div
      slot="filterDropdown"
      slot-scope="{ setSelectedKeys, selectedKeys, confirm, clearFilters, column }"
      style="padding: 8px"
    >
      <a-input
        v-ant-ref="c => (searchInput = c)"
        :placeholder="`筛选${column.title}`"
        :value="selectedKeys[0]"
        style="width: 188px; margin-bottom: 8px; display: block;"
        @change="e => setSelectedKeys(e.target.value ? [e.target.value] : [])"
      />
      <a-button
        type="primary"
        icon="search"
        size="small"
        style="width: 90px; margin-right: 8px"
        @click="() => handleSearch(selectedKeys, confirm, column.dataIndex)"
      >
        筛选
      </a-button>
      <a-button size="small" style="width: 90px" @click="() => handleReset(clearFilters)">
        重置
      </a-button>
    </div>
    <template slot="xu" slot-scope="text,record,index">{{index + 1}}</template>
    <template slot="category" slot-scope="text">
      {{categoryOpts[text]}}
    </template>
    <template slot="action">
      <a-button icon="eye" size="small" type="primary" style="margin-right:5px">查看证书</a-button>
      <a-button icon="download" size="small" type="danger" style="margin-left:5px">下载证书</a-button>
    </template>
  </s-table>
</template>

<script>
import otherColumns from '@/columns/other'
import { STable } from '@/components'

export default {
  components: {
    STable
  },
  name: 'Registered',
  data () {
    return {
      checkColumns: otherColumns.list1,
      checkData: parameters => {
        return new Promise(resolve => {
          resolve({
            data: [
              {
                'id': 6,
                'tm_no': '2000050',
                'tm_name': '天猫',
                'adviser_name': '程婉',
                'notes': '阿达水电费',
                'status': '以下证',
                'category': '3',
                'check_name': '',
                'created_at': '2021-08-23 09:57:14'
              }
            ]
          })
        })
      },
      categoryOpts: {
        '1': '1化工原料',
        '2': '2油漆染料',
        '3': '3日化用品',
        '4': '4油脂染料',
        '5': '5医用药物',
        '6': '6金属材料',
        '7': '7机械机器',
        '8': '8手工用具',
        '9': '9电子产品',
        '10': '10医疗器械',
        '11': '11厨卫设备',
        '12': '12交通工具',
        '13': '13爆炸物品',
        '14': '14珠宝首饰',
        '15': '15乐器',
        '16': '16办公用品',
        '17': '17塑料橡胶',
        '18': '18皮革制品',
        '19': '19非金属建材',
        '20': '20家具',
        '21': '21厨具卫具',
        '22': '22纺织原料',
        '23': '23纱线',
        '24': '24床上用品',
        '25': '25服装鞋帽',
        '26': '26服饰绣品',
        '27': '27地毯席类',
        '28': '28娱乐玩具',
        '29': '29加工食品',
        '30': '30方便食品',
        '31': '31未加工食品',
        '32': '32啤酒饮料',
        '33': '33酒类',
        '34': '34烟及烟类',
        '35': '35广告销售',
        '36': '36金融房产',
        '37': '37建筑装饰',
        '38': '38通讯服务',
        '39': '39物流旅游',
        '40': '40加工服务',
        '41': '41教育培训',
        '42': '42科技研发',
        '43': '43餐饮酒店',
        '44': '44医疗保健',
        '45': '45提供人员'
      },
      searchInput: null,
      searchText: '',
      searchedColumn: '',
      queryParam: {},
      selectedRowKeys: []
    }
  },
  created () {
    this.queryParam['filter[status]'] = 2
  }
}
</script>

<style scoped>

</style>
